from flask import Blueprint

from app.version import views

bp = Blueprint("version", __name__)


# 精确匹配的url放在上面
bp.add_url_rule(
    "/version/latest/<int:version_id>",
    view_func=views.VersionReach.as_view("version_reach"),
    methods=["POST"],
)


bp.add_url_rule(
    "/version/<int:version_id>",
    view_func=views.VersionView.as_view("version"),
    methods=["GET", "PUT", "DELETE"],
)


bp.add_url_rule(
    "/version",
    view_func=views.VersionCreate.as_view("version_create"),
    methods=["POST"],
)

bp.add_url_rule(
    "/versions", view_func=views.Versions.as_view("versions"), methods=["GET"]
)


bp.add_url_rule(
    "/version/latest",
    view_func=views.VersionLatest.as_view("version_latest"),
    methods=["GET"],
)
